export default {
  name: "index",
  data() {
    return {
      userName: '',
      password: '',
      result: '',
    }

  },
  methods: {
    test() {
      console.log()
    },
    register(){

    }
    ,
    user() {
      this.$user.login({
        userName: this.userName,
        password: this.password
      }).then(res => {
        if (res.code == 200) {
          this.result = res.data
          console.log(this.result)
          this.$store.dispatch('getNewToken', res.data)
          this.result = this.$store.getters.getToken
          console.log(this.result)
          this.$router.push("/Menu")
          localStorage.setItem("token", JSON.stringify(this.result))
        }
      })
    }
  }
}
